﻿<!DOCTYPE html>

<html>

<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
    @Scripts.Render("~/Resources/js/knife.static.js")
</head>

<body>
    <div class="framecontainer">
        <div class="cloud-panel">
            <div class="cloud-panel-header ">
                <div class="cloud-panel-title">参数管理</div>
            </div>
            <div class="cloud-panel-body">
                <div class="listcontainer">
                    <div class="searchop">
                        <div class="btnop">
                            <button class="btn btn-op" type="button" onclick="OpenAdd()"><span class="btntext">新增参数</span></button>
                            <button class="btn btn-op" type="button" onclick="BatchDelete()"><span class="btntext">批量删除</span></button>
                        </div>
                        <div class="btnop">
                            <input id="ConfigName" type="text" class="form-control searchinput" placeholder="请输入参数名称">
                            <button class="btn" type="button" onclick="BindGrid()"><i class="icon icon-search"></i><span class="searchtext">查询</span></button>
                        </div>
                    </div>
                    <div class="tableop">
                        <table class="GridStyle" id="CloudGrid" keyid="ConfigGuid" url="list" relationpageid="cloudpagination" otherparm="SearchParm" afterbind="AfterBindData">
                            <tr class="HeaderStyle">
                                <th scope="col" style="width: 10px;" field="check" rowalign="center"></th>
                                <th scope="col" style="width: 10px;" field="index" rowalign="center">序</th>
                                <th scope="col" style="width: 200px;" field="config_name" rowalign="left">参数名称</th>
                                <th scope="col" style="width: 200px;" field="config_value" rowalign="left">参数值</th>
                                <th scope="col" field="config_remark" rowalign="left">备注</th>
                                <th scope="col" style="width: 50px;" field="sort_num" rowalign="center">排序</th>
                                <th scope="col" style="width: 50px;" field="EditButton" functionname="GridEdit" rowalign="center">编辑</th>
                            </tr>
                        </table>
                    </div>
                    <div class="bottomop">
                        <div class="pageop">
                            <ul class="pagination" id="cloudpagination"></ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        $(function () {
            BindGrid();
        })
        function BindGrid() {
            BindCloudGrid($("#CloudGrid"))
        }

        function SearchParm() {
            return {
                "configName": $("#ConfigName").val(),
            };
        }
        function AfterBindData() {

        }
        function OpenAdd() {
            OpenTopDialog("新增参数", "system/config/addPage", 400, 800, BindGrid)
        }
        function BatchDelete() {
            var SelectRows = CloudGridChecked($("#CloudGrid"));
            if (SelectRows.length > 0) {
                OpenConfirm("确认删除选中的数据？", function () {
                    CloudPost({ "KeyID": SelectRows }, "batchDelete", function (res) {
                        if (res.code == 0) {
                            OpenSuccess("删除成功！", function () {
                                BindGrid();
                            })
                        } else {
                            OpenFail(res.data);
                        }
                    })
                })
            }
        }
        function GridEdit(RowData) {
            OpenTopDialog("编辑参数", "system/config/editPage?row_id=" + RowData.row_id, 400, 800, BindGrid)
        }
    </script>
</body>
</html>